
/* GENERATED CODE:
 *  Any modifications you make are guaranteed
 *  to be deleted when this is regenerated.
 * Please edit "PROTOCOLS" inside this directory
 *
 * Names are all upper case because of "String" and "string."
 */

using System;
using System.Collections.Generic;
using System.Text;
using System.Xml;
using OWED.Network.Messages.General;
using OWED.Network.Messages;
using OWED.Network.Messages.Reply;


namespace OWED.Network.Messages.General
{
	public class Changes: IProtocolItem 
	{
		List <Change> my_ChangeAtoms;
		public Changes (List <Change> ChangeAtoms)
		{
			my_ChangeAtoms = ChangeAtoms;
		}
		public List <Change> ChangeAtoms { get { return my_ChangeAtoms; } }


		public static new Changes FromXml(XmlDocument xml)
		{
			XmlDocument doc;
			if (true) {
				XmlNodeList list_ChangeAtoms = xml.SelectNodes("Changes/Change");
				List <Change> ChangeAtoms = new List <Change>();
				foreach (XmlNode node in list_ChangeAtoms) {
					doc = new XmlDocument();
					doc.AppendChild(doc.ImportNode(node, true));
					ChangeAtoms.Add(Change.FromXml(doc));
				}

				return new Changes(ChangeAtoms);
			}
		}


		public override XmlDocument ToXml()		{
			XmlDocument doc = new XmlDocument();

			doc.AppendChild(doc.CreateElement("Changes"));

			if (my_ChangeAtoms != null) {
				XmlNode node;
				foreach (Change item in my_ChangeAtoms) {
					node = doc.ImportNode(item.ToXml().FirstChild, true);
					doc.FirstChild.AppendChild(node);
				}
			}

			return doc;
		}
	}
}
